//任务类型下拉选中计划任务
if ($this.model["select_1711505903223_YWk8w"] == "ae7e345ca8fd76827a3590e038efb94b"){
    for (let i = 0; i < $this.form.fields.length; i++) {
        console.log("fields_name",$this.form.fields[i]["name"])
        if ($this.form.fields[i]["name"] === "select_1711505903223_YWk8w"){
            //任务类型只读
            $this.form.fields[i]['readonly'] = true
        }
    }
}

//业务:动态隐藏字典项,查找字典值中的计划任务,并将其从数组中移除
for (let i = 0; i < $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].length; i++) {
    //隐藏计划任务
    if ($this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"][i]["dictDataId"] === "ae7e345ca8fd76827a3590e038efb94b"){
        $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].splice(i,1)
    }
    console.log("隐藏会议任务")
    //隐藏会议任务
    if ($this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"][i]["dictDataId"] === "e0f13da9d1df4bd692518af8430845fe"){
        $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].splice(i,1)
    }
    //隐藏合理化建议
    console.log("隐藏合理化建议")
    if ($this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"][i]["dictDataId"] === "3a275c0eeea14665afce10787a8c42df"){
        $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].splice(i,1)
    }
    //隐藏研发评审遗留问题
    console.log("隐藏研发评审遗留问题")
    if ($this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"][i]["dictDataId"] === "01fc5f55816fd1eafa2f7da5277e9b8d"){
        $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].splice(i,1)
    }
    //隐藏技术设计变更
    if ($this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"][i]["dictDataId"] === "cf10c8b9abc315f5849900ddb5d2489c"){
        $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].splice(i,1)
    }
    //隐藏研发关联问题
    if ($this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"][i]["dictDataId"] === "c0ae1698d0ff0544d555151c87a08db2"){
        $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].splice(i,1)
    }
    //隐藏设计预投申请问题
    if($this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"][i]["dictDataId"] === "9d65629edb0dc87283d06fbd1572c69d"){
        $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].splice(i,1)
    }
}

//新增页面
if($this.pageType == 'add'){
    if ($this.$store.state.user.tabs[$this.$store.state.user.tabs.length - 1]){
        let id = $this.$store.state.user.tabs[$this.$store.state.user.tabs.length - 1].id
        let riskData = $this.$store.state.user.tabs[$this.$store.state.user.tabs.length - 1].riskData
        if (id !=undefined){
            $this.taskId = id
            let url = $this.$util.getAPI_URL();
            let formData=new FormData();
            formData.append("id",id);
            url = url.replace("api", "task/taskbyId");
            //最后一个标签页的数据有id则调用API获取任务详情，将返回的数据赋值到$this.model中
            $this.$http.post(url,formData).then((res) => {
                if(res.data.code===280){
                    //数据赋值逻辑
                    $this.model.input_1711507868739_utRet = res.data.data[0]["bill_id"]
                    $this.model.input_1711507870054_pCWPe = res.data.data[0]["commonNumber_1711532225675_bFKuy"]
                    $this.model.input_1711507872142_QBS6q = res.data.data[0]["input_1711439260720_6QPqX"]
                    $this.model.input_1718345101976_ZNGth = res.data.data[0]["input_1718345101976_ZNGth"]
                    $this.model.input_1718345101976_PBcTl = res.data.data[0]["input_1718345101976_PBcTl"]
                    $this.model.selectStr_1718345029613_IWjr8 = res.data.data[0]["selectStr_1718345029613_IWjr8"]
                    $this.model.selectStr_1718345029613_IWjr8_ID = res.data.data[0]["selectStr_1718345029613_IWjr8_ID"]

                    if(!Array.isArray(res.data.data[0]["rangePicker_1711439307444_Ftzhm"])){
                        let dates = JSON.parse(res.data.data[0]["rangePicker_1711439307444_Ftzhm"])
                        $this.model.rangePicker_1754897348453_DOtbH = [$this.moment(dates[0], "YYYY-MM-DD HH:mm:ss"), $this.moment(dates[1], "YYYY-MM-DD HH:mm:ss")]
                    }else{
                        $this.model.rangePicker_1754897348453_DOtbH = [$this.moment(res.data.data[0]["rangePicker_1711439307444_Ftzhm"][0], "YYYY-MM-DD HH:mm:ss"), $this.moment(res.data.data[0]["rangePicker_1711439307444_Ftzhm"][1], "YYYY-MM-DD HH:mm:ss")]
                    }

                    $this.model.select_1711505903223_YWk8w = res.data.data[0]["select_1711505903223_YWk8w"]
                    if (res.data.data[0]["input_1711505190040_mjQ7O"]){
                        $this.model.input_1711505190040_mjQ7O = res.data.data[0]["input_1711505190040_mjQ7O"]
                        $this.model.input_1711505191772_z744J = res.data.data[0]["input_1711505191772_z744J"]
                        //向字典中添加一个新的项
                        $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].push({
                            "dictDataId": "ae7e345ca8fd76827a3590e038efb94b",
                            "dictId": "caaaa4d81408aa1c03564db7f70660ac",
                            "dictDataCode": "JHRW",
                            "dictDataName": "计划任务",
                            "dictDataNameEn": "Planned tasks",
                            "dictDataNameJp": "計画タスク",
                            "sortNumber": 3,
                            "dictCode": null,
                            "dictName": null,
                            "dictType": null
                        })
                        for (let i = 0; i < $this.form.fields.length; i++) {
                            if ($this.form.fields[i]["name"] === "select_1711505903223_YWk8w"){
                                $this.form.fields[i]['readonly'] = true
                            }
                        }

                    }
                    $this.$nextTick(() => {
                        document.getElementById("selectStr_1718345029613_IWjr8_NO").value = res.data.data[0]["input_1718345101976_PBcTl"]
                    });
                }
            })
            //
            for (let i = 0; i < $this.form.fields.length; i++) {
                //字段显示控制
                if ($this.form.fields[i].name == 'separator_1711507808321_wPJ5T' || $this.form.fields[i].name == 'input_1711507872142_QBS6q' || $this.form.fields[i].name == 'rangePicker_1754897348453_DOtbH'){
                    //控制字段的显示状态
                    $this.form.fields[i].isShow=true
                }
            }
        }
        //页面数据赋值
        if (riskData!=undefined){
            console.log(1231321321)
            $this.model.select_1711505903223_YWk8w = '88b3d81abfc18c0a0dffe358db029aa8'
            $this.model.selectStr_1718345029613_IWjr8 = riskData["项目表单编号"]
            $this.model.selectStr_1718345029613_IWjr8_ID = riskData["项目ID"]
            $this.model.input_1718345101976_ZNGth = riskData["项目编号"]
            $this.model.input_1718345101976_PBcTl = riskData["项目名称"]
            $this.model.input_1720753145812_YHQZf = riskData["FXID"]
            $this.model.input_1711439260720_6QPqX = riskData["项目名称"]
            $this.$nextTick(() => {
                document.getElementById("selectStr_1718345029613_IWjr8_NO").value = riskData["项目名称"]
            });
            $this.model.systemSelect_1711439392784_Njyxy = riskData["ZXR"]
            document.getElementById("systemSelect_1711439392784_Njyxy_ID").value = riskData["ZXRID"]
        }
        console.log(document.getElementById("selectStr_1718345029613_IWjr8_NO").value)
        let url = $this.$route.href
        let questionMarkIndex = url.indexOf("?");
        if (questionMarkIndex !== -1) {
            //根据URL的查询参数Type,设置select_1711505903223_YWk8w 的值
            let type = url.substring(questionMarkIndex + 1);
            if (type == 1){
                //项目任务
                $this.model.select_1711505903223_YWk8w = "88b3d81abfc18c0a0dffe358db029aa8"
            }else if(type == 0){
                //合理化提案
                $this.model.select_1711505903223_YWk8w = "3a275c0eeea14665afce10787a8c42df"
            }
        }
    }
}
